<?php
// +----------------------------------------------------------------------
// | KITEGO-Admin「开箱即用」「人人全栈」
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2024 https://www.kitego.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed KITEGO并不是自由软件，未经许可不能去掉KITEGO相关版权
// +----------------------------------------------------------------------
// | Author: KITEGO Team <bd@kitego.cn>
// +----------------------------------------------------------------------

namespace app\adminapi\validate\setting;

use think\Validate;

class SystemDeptValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'pid|部门父节点' => 'require|number',
        'label|部门名称' => 'require',
        'remark|部门备注' => 'require',
        'sort|部门排序值' => 'require|number',
        'status|部门开启状态' => ['require', 'in' => '0,1'],
        'deleteFlag|部门删除标识' => ['require', 'in' => '0,1'],
        'ids|部门ids' => 'require|array'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'deleteFlag.in' => 'deleteFlag必须是0或1',
        'status.in' => 'status必须是0或1'
    ];

    /**
     * 验证场景定义
     * @var array
     */
    protected $scene = [
        'editSystemDept' => ['pid', 'label', 'remark', 'sort', 'status', 'deleteFlag'],
        'batchDelSystemDept' => ['ids']
    ];
}
